package com.brush.system.domain.resp.sysmenu;

import com.brush.common.core.domain.entity.SysMenu;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;
import java.util.List;

@Getter
@Setter
@ApiModel(value = "SysMenuResp", description = "菜单响应对象")
public class SysMenuResp {
    @ApiModelProperty(value = "菜单主键")
    private Long menuId;

    /**
     * 菜单名称
     */
    @ApiModelProperty(value = "菜单名称")
    private String menuName;

    /**
     * 父菜单ID
     */
    @ApiModelProperty(value = "父菜单ID")
    private Long parentId;

    /**
     * 显示顺序
     */
    @ApiModelProperty(value = "显示顺序")
    private Integer orderNum;

    /**
     * 路由地址
     */
    @ApiModelProperty(value = "路由地址")
    private String path;

    /**
     * 组件路径
     */
    @ApiModelProperty(value = "组件路径")
    private String component;

    /**
     * 菜单状态（0正常 1停用）
     */
    @ApiModelProperty(value = "菜单状态（0正常 1停用）")
    private String status;

    /**
     * 权限字符串
     */
    @ApiModelProperty(value = "权限字符串")
    private String perms;

    /**
     * 菜单图标
     */
    @ApiModelProperty(value = "菜单图标")
    private String icon;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @ApiModelProperty(value = "子菜单")
    private List<SysMenuResp> children;

    public SysMenuResp() {
    }

    public SysMenuResp(SysMenu menu) {
        this.menuId = menu.getMenuId();
        this.menuName = menu.getMenuName();
        this.parentId = menu.getParentId();
        this.orderNum = menu.getOrderNum();
        this.path = menu.getPath();
        this.component = menu.getComponent();
        this.status = menu.getStatus();
        this.perms = menu.getPerms();
        this.icon = menu.getIcon();
        this.createTime = menu.getCreateTime();
    }

}
